#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>

using namespace std;

int maxSubArray(vector<int>& nums) {
    int n = nums.size();
    int cur = INT_MIN, res = INT_MIN;
    vector<int> f(n + 1, INT_MIN);
    for (int i = 1; i <= n; i++)
    {
        cur = max(0, cur);
        cur += nums[i - 1];
        res = max(res, cur);
    }
    return res;
}

int main()
{
    vector<int> v = { -1 };
    maxSubArray(v);
    return 0;
}
